// Copyright (c) 2006, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//
// Author: arvin.chen
//
//

#ifndef ALGORITHM_SORT_BASE_H_
#define ALGORITHM_SORT_BASE_H_

#include <string>

namespace algorithm {
	namespace sort {
		enum SortType {
			kNone = 0,
			kSelect,
			kInsert,
			kBubble,
			kBubbleOptimize,
			kShell,
			kMerge,
			kMergeRecursion,
			kQuick,
			kQuickRecursion,
			kHeap,
			kCount,
			kCountOptimize,
			kBucket,
			kRadix,
			kAll,
			kInvalid = -1,
		};
		static const std::string kSortTypeName[kAll] = {
			"SortType",
			"Select",
			"Insert",
			"Bubble",
			"BubbleOptimize",
			"Shell",
			"Merge",
			"MergeRecursion",
			"Quick",
			"QuickRecursion",
			"Heap",
			"Count",
			"CountOptimize",
			"Bucket",
			"Radix"
		};

		template<typename T>
		class Base {
		public:

			/**
			* Construction
			*
			* @param SortType
			* @return
			*/
			Base(SortType type)
				: type_(type)
			{
				
			}

			/**
			* Destruction
			*
			* @param VOID
			* @return
			*/
			~Base()
			{

			}

			/**
			* sort
			*
			* @param T arr[]
			* @param int len
			* @return T
			*/
			virtual T* sort(T arr[], int len) = 0;

			SortType GetType()
			{
				return type_;
			}

			std::string GetTypeName()
			{
				return kSortTypeName[type_];
			}

		protected:
			/**
			* Assignment
			*
			* @param const Base& cbase
			* @return Base&
			*/
			Base& operator=(const Base& cbase);

			/**
			* Copy Construction
			*
			* @param const Base& cbase
			* @return
			*/
			Base(const Base& cbase);

		private:

		public:
		protected:
		private:
			SortType type_;
		};
	} // namespace algorithm 
} // namespace sort


#endif  // ALGORITHM_SORT_BASE_H_
